<?php

namespace app\Admin\model;

use think\Model;

class Works extends Model
{
    //定义主键
    protected $pk = 'id';
    //定义表名
    protected $table = 'art_works';
    //定义全局查询范围
    protected function base($query){
        $query->where('status',1);
    }
    /**
     * 设置查询范围
     */
    public function scopeSubject($query,$subject_id){
        $query -> where('subject_id','in',$subject_id);
    }
    public function  scopeUser($query,$user_id){
        $query ->whereNotIn('user_id',$user_id);
    }
}
